//
//  DODBObject.h
//  DOFramework
//
//  Created by 鞠 文杰 on 14-5-13.
//  Copyright (c) 2014年 dono. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>


/**
 *  本地存储 使用同步方法
 */
@interface DODBObject : NSObject


//- (id)initWithTableName:(NSString *)tablename;

//实例方法
- (NSError *)save;

- (NSError *)update;

- (NSError *)deleteSelf;

- (sqlite3 *)database;


//类方法
+ (NSArray *)allObjects;

+ (NSArray *)queryByPage:(int)page andLimit:(int)limit;

+ (NSError *)saveObjects:(NSArray *)objects;
+ (NSError *)saveObjects1:(NSArray *)objects;

+ (id)queryByPK:(NSInteger)pk;

+ (void)removeAll;

+ (NSArray *)queryBySQL:(NSString *)sql;

+ (void)updateTable:(NSString*)sql;
+ (void)chekcTable;

+ (NSInteger)pkIndexFromDB;

+ (void)syncPkIndexToDB:(NSInteger)pk;


@end
